/**
 * Company : SIANGKLOM.
 * Created By : Chatree Siangklom
 * Created On : Oct 4, 2013  6:50:13 PM 
 * e-Mail : dr_chatree@hotmail.com
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : sap.business.commons
 * File Name : JCOReturn.java
 * TODO
 */
package sap.business.commons;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import promis.utility.CommonService;
import com.sap.conn.jco.JCoTable;

/**
 * @author Chatree Siangklom of Administrator
 * Date =Oct 4, 2013 : 6:50:13 PM 
 * CreateBy=Chatree Siangklom
 * 
 * JCOReturn
 * TODO
 */
public class JCOReturn {
	
	private static final Logger logging = LoggerFactory.getLogger(JCOReturn.class);

	/**
	 * Date =Oct 4, 2013 : 6:50:13 PM 
	 * CreateBy=Chatree Siangklom
	 * JCOReturn
	 * TODO
	 */
	public JCOReturn() {
		// TODO Auto-generated constructor stub
	}
	
	public static String toString(JCoTable jcoTable_return) throws Exception {
		try{
			if(!jcoTable_return.isEmpty()){
				
				String PMS_STAGING_ID = (CommonService.IsNullRNull(jcoTable_return.getString("PMS_STAGING_ID")) == null ? " No Message." : CommonService.IsNullRNull(jcoTable_return.getString("PMS_STAGING_ID")));
				String MSG_CODE = (CommonService.IsNullRNull(jcoTable_return.getString("MSG_CODE")) == null ? " No Message." : CommonService.IsNullRNull(jcoTable_return.getString("MSG_CODE")));
				String MSG_DESC = (CommonService.IsNullRNull(jcoTable_return.getString("MSG_DESC")) == null ? " No Message." : CommonService.IsNullRNull(jcoTable_return.getString("MSG_DESC")));
				String MSG_ALT_DESC = (CommonService.IsNullRNull(jcoTable_return.getString("MSG_ALT_DESC")) == null ? " No Message." : CommonService.IsNullRNull(jcoTable_return.getString("MSG_ALT_DESC")));
				
				System.out.println("PMS_STAGING_ID=" + PMS_STAGING_ID + " //MSG_CODE=" + MSG_CODE + " //MSG_DESC=" + MSG_DESC + "// MSG_ALT_DESC=" + MSG_ALT_DESC);				
				return ("PMS_STAGING_ID=" + PMS_STAGING_ID + " //MSG_CODE=" + MSG_CODE + " //MSG_DESC=" + MSG_DESC + "// MSG_ALT_DESC=" + MSG_ALT_DESC);
			
			}else{
				System.out.println("Update Message Retrun table getNumRows = " + jcoTable_return.getNumRows() +" Row, is Empty.");
				return "Update Message Retrun table getNumRows = " + jcoTable_return.getNumRows() +" Row, is Empty.";
			}
		}catch(Exception e)
		{
			logging.error(e.getMessage());
			System.err.println(e.getMessage());
			throw e;
		}
	}

}
